package com.caius.xiaohashu.note.biz.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author Caius
 * @description
 * @since Created in 2025-05-27
 */
@Getter
@AllArgsConstructor
public enum NoteUnlikeLuaResultEnum {
    NOT_EXISTS(-1L),
    NOTE_LIKED(1L),
    NOTE_NOT_LIKED(0L),
    ;

    private final Long code;

    /**
     * 根据 code 类型获取对应的枚举对象
     * @param code
     * @return
     */
    public static NoteUnlikeLuaResultEnum valueOf(Long code) {
        for (NoteUnlikeLuaResultEnum noteUnlikeLuaResultEnum : NoteUnlikeLuaResultEnum.values()) {
            if (Objects.equals(noteUnlikeLuaResultEnum.getCode(), code)) {
                return noteUnlikeLuaResultEnum;
            }
        }
        return null;
    }
}
